package ch.nostromo.tiffanys.clients.desktop.gui.board;

import java.awt.BorderLayout;

import javax.swing.WindowConstants;

import uk.ac.cam.cl.projectcharlie2010.clients.desktop.gui.Desktop;

import ch.nostromo.lib.controller.NosResourcesException;
import ch.nostromo.lib.swing.NosInternalFrame;

  public class BoardFrame extends NosInternalFrame {

  private static final long serialVersionUID = 1L;

  private BoardPanel boardPanel;

  private Desktop desktop;

  public BoardFrame(Desktop desktop) throws NosResourcesException {
    super();
    this.desktop = desktop;    
    initGUI();
    initTiffGui();
  }

  public BoardPanel getBoardPanel() {
    return boardPanel;
  }
  
  
  private void initGUI() throws NosResourcesException {

      BorderLayout thisLayout = new BorderLayout();
      this.getContentPane().setLayout(thisLayout);
      setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
      {
        boardPanel = new BoardPanel(desktop);
        this.getContentPane().add(boardPanel, BorderLayout.CENTER);
        boardPanel.setPreferredSize(new java.awt.Dimension(360, 360));
      }
      pack();

  }

  private void initTiffGui() {
    boardPanel.setSize(this.getSize());
  }

}
